package com.lyf.boot.runner;

import com.lyf.boot.modules.system.service.IOssConfigService;
import com.lyf.boot.modules.system.service.ISysDictService;
import com.lyf.boot.properties.MqttProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @author Luyufan
 * @date 2023/7/7 17:48
 */
@Slf4j
@RequiredArgsConstructor
@Component
public class SystemApplication implements ApplicationRunner {

    private final ISysDictService sysDictService;

    private final IOssConfigService ossConfigService;

    private final MqttProperties mqttProperties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        sysDictService.asyncSysDict();
        log.info("字典缓存加载成功");
        ossConfigService.initOssConfig();
        log.info("oss对象存储注入成功");
        log.info("mqtt.enabled: {}", mqttProperties.getEnabled());
    }
}
